home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
mdi
/
ttedit
/
mdi.frm
< prev
next >
Wrap
Text File
|
1995-01-04
|
19KB
|
630 lines
VERSION 2.00
Begin MDIForm MDI
ClientHeight = 4470
ClientLeft = 1215
ClientTop = 2835
ClientWidth = 9255
Height = 5160
Icon = MDI.FRX:0000
Left = 1155
LinkTopic = "TT_Editor"
Top = 2205
Width = 9375
Begin PictureBox StatusBar
Align = 2 'Align Bottom
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H00C0C0C0&
ClipControls = 0 'False
Height = 330
Left = 0
ScaleHeight = 20
ScaleMode = 3 'Pixel
ScaleWidth = 615
TabIndex = 0
TabStop = 0 'False
Top = 4140
Width = 9255
Begin PictureBox Picture2
AutoRedraw = -1 'True
AutoSize = -1 'True
ClipControls = 0 'False
FillColor = &H00404040&
FillStyle = 0 'Solid
Height = 195
Left = 600
ScaleHeight = 11
ScaleMode = 3 'Pixel
ScaleWidth = 15
TabIndex = 1
TabStop = 0 'False
Top = 60
Visible = 0 'False
Width = 255
End
Begin Label lblExtraCaption
Alignment = 2 'Center
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 214
Left = 4410
TabIndex = 6
Top = 29
Width = 1980
End
Begin Label lblNumLock
Alignment = 2 'Center
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 214
Left = 7080
TabIndex = 5
Top = 29
Width = 540
End
Begin Label lblCapslock
Alignment = 2 'Center
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 210
Left = 6480
TabIndex = 4
Top = 29
Width = 540
End
Begin Label lblDateTime
Alignment = 2 'Center
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 210
Left = 7680
TabIndex = 3
Top = 30
Width = 1485
End
Begin Label lblStatusText
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 214
Left = 60
TabIndex = 2
Top = 29
Width = 4275
End
End
Begin PictureBox ToolBar
Align = 1 'Align Top
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
ClipControls = 0 'False
Height = 495
Left = 0
ScaleHeight = 33
ScaleMode = 3 'Pixel
ScaleWidth = 617
TabIndex = 7
TabStop = 0 'False
Top = 0
Width = 9255
Begin Image ToolButton
Height = 330
Index = 6
Left = 1440
Picture = MDI.FRX:0302
Tag = "Find"
Top = 60
Width = 360
End
Begin Image ToolButton
Height = 330
Index = 8
Left = 8160
Picture = MDI.FRX:0484
Tag = "Lookup Help"
Top = 60
Width = 360
End
Begin Image ToolButton
Height = 330
Index = 7
Left = 7800
Picture = MDI.FRX:0606
Tag = "Show ToolTips"
Top = 60
Width = 360
End
Begin Image ToolButton
Height = 330
Index = 5
Left = 2520
Picture = MDI.FRX:0788
Tag = "Paste"
Top = 60
Width = 360
End
Begin Image ToolButton
Height = 330
Index = 4
Left = 2160
Picture = MDI.FRX:090A
Tag = "Copy"
Top = 60
Width = 360
End
Begin Image ToolButton
Height = 330
Index = 3
Left = 1800
Picture = MDI.FRX:0A8C
Tag = "Cut"
Top = 60
Width = 360
End
Begin Image ToolButton
Height = 330
Index = 2
Left = 960
Picture = MDI.FRX:0C0E
Tag = "Print"
Top = 60
Width = 360
End
Begin Image ToolButton
Height = 330
Index = 1
Left = 120
Picture = MDI.FRX:0D90
Tag = "New"
Top = 60
Width = 360
End
Begin Image ToolButton
Height = 330
Index = 0
Left = 480
Picture = MDI.FRX:0F12
Tag = "Open"
Top = 60
Width = 360
End
End
Begin Menu mnu_File
Caption = "&File"
Begin Menu mnu_File_New
Caption = "&New"
Tag = "Create a New document."
End
Begin Menu mnu_File_Open
Caption = "&Open..."
Tag = "Open an existing document."
End
Begin Menu mnu_File_Save
Caption = "Save"
End
Begin Menu mnu_File_SaveAs
Caption = "Save &As..."
End
Begin Menu mnu_File_Sep1
Caption = "-"
End
Begin Menu mnu_File_Print
Caption = "&Print"
Tag = "Print the active document."
End
Begin Menu mnu_File_PageSetup
Caption = "Page Se&tup..."
End
Begin Menu mnu_File_PrintSetup
Caption = "P&rint Setup..."
End
Begin Menu mnu_File_Sep2
Caption = "-"
End
Begin Menu mnu_File_exit
Caption = "E&xit"
End
End
Begin Menu mnu_Edit
Caption = "&Edit"
Begin Menu mnu_Edit_Undo
Caption = "&Undo"
Shortcut = ^Z
End
Begin Menu mnu_Edit_Sep1
Caption = "-"
End
Begin Menu mnu_Edit_Cut
Caption = "Cu&t"
Shortcut = ^X
Tag = "Cut the selection and put it on the Clipboard"
End
Begin Menu mnu_Edit_Copy
Caption = "&Copy"
Shortcut = ^C
Tag = "Copy the selection and put it on the Clipboard"
End
Begin Menu mnu_Edit_Paste
Caption = "Paste"
Shortcut = ^V
Tag = "Insert Clipboard contents"
End
Begin Menu mnu_Edit_Delete
Caption = "De&lete"
Shortcut = {DEL}
Tag = "Delete"
End
Begin Menu mnu_Edit_Sep2
Caption = "-"
End
Begin Menu mnu_Edit_SelectAll
Caption = "Select &All"
End
Begin Menu mnu_Edit_TimeDate
Caption = "Time/&Date"
Shortcut = {F5}
End
Begin Menu mnu_Edit_Sep3
Caption = "-"
End
Begin Menu mnu_Edit_WordWrap
Caption = "&Word Wrap"
End
End
Begin Menu mnu_Search
Caption = "&Search"
Tag = "Find the specified text."
Begin Menu mnu_Search_Find
Caption = "&Find..."
Tag = "Find the specified text."
End
Begin Menu mnu_Search_FindNext
Caption = "Find &Next"
Shortcut = {F3}
End
End
Begin Menu mnu_Options
Caption = "&Options"
Begin Menu mnu_Options_Toolbar
Caption = "&Toolbar"
Checked = -1 'True
End
Begin Menu mnu_Options_Statusbar
Caption = "&Statusbar"
Checked = -1 'True
End
Begin Menu mnu_Options_Tooltips
Caption = "Tool Ti&ps"
Checked = -1 'True
End
End
Begin Menu mnuWindow
Caption = "&Window"
WindowList = -1 'True
Begin Menu mnu_Window_Cascade
Caption = "&Cascade"
Shortcut = +{F5}
End
Begin Menu mnu_Window_Tile
Caption = "&Tile"
Shortcut = +{F4}
End
Begin Menu mnu_Window_Arrange_Icons
Caption = "&Arrange Icons"
End
End
Begin Menu mnu_Help
Caption = "&Help"
Begin Menu mnu_Help_HelpTopics
Caption = "&Help Topics..."
End
Begin Menu mnu_Help_Sep1
Caption = "-"
End
Begin Menu mnu_Help_About
Caption = "&About "
End
End
End
Option Explicit
'
' Set the Constants APP_TITLE etc in TT_edit.bas
'
Sub MDIForm_Load ()
Caption = APP_TITLE
mnu_Help_About.Caption = "&About " & APP_TITLE & "..."
Call Create_OtherButtons(Me, Picture2, TOTAL_BUTTONS, BUTTON_OPEN, BUTTON_HELP)
Call BindMenus
Call EditMenu(False)
Call GetWindowPos(Me)
Show
End Sub
'
' Write the window position to an ini file.
'
Sub MDIForm_Resize ()
If WindowState = 0 And Visible Then Call SaveWindowPos(Me)
End Sub
'
' Unload the associated help file
'
Sub MDIForm_Unload (Cancel As Integer)
If Winhelp(hWnd, APP_HELPFILE, HELP_QUIT, ByVal 0&) Then
End If
Unload frmFind
End
End Sub
'
' In this app , "Screen.ActiveForm.ActiveControl.hWnd" will always be valid.
' You may need to test this in your app.
'
Sub mnu_Edit_Copy_Click ()
If SendMessage(Screen.ActiveForm.ActiveControl.hWnd, WM_COPY, 0, ByVal 0&) Then
End If
End Sub
'
' In this app , "Screen.ActiveForm.ActiveControl.hWnd" will always be valid.
' You may need to test this in your app.
'
Sub mnu_Edit_Cut_Click ()
If SendMessage(Screen.ActiveForm.ActiveControl.hWnd, WM_CUT, 0, ByVal 0&) Then
End If
End Sub
'
' In this app , "Screen.ActiveForm.ActiveControl.hWnd" will always be valid.
' You may need to test this in your app.
'
Sub mnu_Edit_Delete_Click ()
If SendMessage(Screen.ActiveForm.ActiveControl.hWnd, WM_CLEAR, 0, ByVal 0&) Then
End If
End Sub
'
' In this app , "Screen.ActiveForm.ActiveControl.hWnd" will always be valid.
' You may need to test this in your app.
'
Sub mnu_Edit_Paste_Click ()
If SendMessage(Screen.ActiveForm.ActiveControl.hWnd, WM_PASTE, 0, ByVal 0&) Then
End If
End Sub
'
' In this app , "Screen.ActiveForm.ActiveControl.hWnd" will always be valid.
' You may need to test this in your app.
'
Sub mnu_Edit_SelectAll_Click ()
If SendMessage(Screen.ActiveForm.ActiveControl.hWnd, EM_SETSEL, 0, ByVal &HFFFF0000) Then
End If
End Sub
'
' In this app , "Screen.ActiveForm.ActiveControl.hWnd" will always be valid.
' You may need to test this in your app.
'
Sub mnu_Edit_TimeDate_Click ()
Dim DateTime As String
DateTime = CStr(Format$(Now, "Medium Date") & " " & Format$(Now, "Medium Time")) & Chr(0)
If SendMessage(Screen.ActiveForm.ActiveControl.hWnd, EM_REPLACESEL, 0, ByVal MemAddr(DateTime)) Then
End If
End Sub
'
' In this app , "Screen.ActiveForm.ActiveControl.hWnd" will always be valid.
' You may need to test this in your app.
'
Sub mnu_Edit_Undo_Click ()
If SendMessage(Screen.ActiveForm.ActiveControl.hWnd, EM_UNDO, 0, ByVal 0&) Then
End If
End Sub
Sub mnu_Edit_WordWrap_Click ()
Dim CurrentText As String
mnu_Edit_WordWrap.Checked = Not mnu_Edit_WordWrap.Checked
If mnu_Edit_WordWrap.Checked Then
ActiveForm.txtWordWrap = ActiveForm.txtTextEdit
ActiveForm.txtTextEdit.Visible = False
ActiveForm.txtWordWrap.Visible = True
ActiveForm.txtWordWrap.SelStart = ActiveForm.txtTextEdit.SelStart
Else
ActiveForm.txtTextEdit = ActiveForm.txtWordWrap
ActiveForm.txtTextEdit.Visible = True
ActiveForm.txtWordWrap.Visible = False
ActiveForm.txtTextEdit.SelStart = ActiveForm.txtWordWrap.SelStart
End If
If SendMessage(ActiveForm.ActiveControl.hWnd, EM_SETMODIFY, True, ByVal 0&) Then
End If
End Sub
Sub mnu_File_exit_Click ()
Unload Me
End Sub
Sub mnu_File_New_Click ()
Call NewFile
End Sub
Sub mnu_File_Open_Click ()
Call FileOpen
End Sub
Sub mnu_File_PageSetup_Click ()
frmPageSetup.Show 1
' Call PageSetup
End Sub
Sub mnu_File_PrintSetup_Click ()
Call PrinterSetup
End Sub
Sub mnu_File_Save_Click ()
Call FileSave
End Sub
Sub mnu_File_SaveAs_Click ()
Dim Filename As String
Filename = ActiveForm.Caption
If Filename = NEW_FILE_TITLE Then Filename = " "
Filename = FileSaveAs(Filename)
If Len(Filename) Then
Call WriteFile(Filename, CStr(ActiveForm.ActiveControl))
ActiveForm.Caption = Filename
If Not Err Then
If SendMessage(ActiveControl.hWnd, EM_SETMODIFY, False, ByVal 0&) Then
End If
End If
End If
End Sub
Sub mnu_Help_About_Click ()
frmAbout.btnOK.Visible = True
frmAbout.Show 1
End Sub
Sub mnu_Help_HelpTopics_Click ()
If Winhelp(hWnd, APP_HELPFILE, HELP_CONTENTS, ByVal 0&) Then
End If
End Sub
Sub mnu_Options_Statusbar_Click ()
mnu_Options_Statusbar.Checked = Not mnu_Options_Statusbar.Checked
StatusBar.Visible = mnu_Options_Statusbar.Checked
End Sub
Sub mnu_Options_Toolbar_Click ()
mnu_Options_Toolbar.Checked = Not mnu_Options_Toolbar.Checked
ToolBar.Visible = mnu_Options_Toolbar.Checked
mnu_Options_ToolTips.Enabled = mnu_Options_Toolbar.Checked
End Sub
Sub mnu_Options_Tooltips_Click ()
mnu_Options_ToolTips.Checked = Not mnu_Options_ToolTips.Checked
Call SynchButtons
End Sub
Sub mnu_Search_Find_Click ()
Dim F As Form
Set F = frmFind
F.Left = Width + Left - F.Width
F.Top = Height + Top - F.Height - StatusBar.Height
frmFind.Show
End Sub
Sub mnu_Search_FindNext_Click ()
Dim F As Form
Set F = frmFind
If Len(F.txtSearch) Then
frmFind.btnFindNext.Value = True
Else
F.Left = Width + Left - F.Width
F.Top = Height + Top - F.Height - StatusBar.Height
F.Show
End If
End Sub
Sub mnu_Window_Arrange_Icons_Click ()
Arrange ARRANGE_ICONS
End Sub
Sub mnu_Window_Cascade_Click ()
Arrange CASCADE
End Sub
Sub mnu_Window_Tile_Click ()
Arrange TILE_VERTICAL
End Sub
Sub StatusBar_Resize ()
StatusBar.Cls
lblDateTime.Left = StatusBar.ScaleWidth - lblDateTime.Width - 4
lblNumlock.Left = lblDateTime.Left - lblNumlock.Width - 4
lblCapsLock.Left = lblNumlock.Left - lblCapsLock.Width - 4
lblExtraCaption.Left = lblCapsLock.Left - lblExtraCaption.Width - 4
On Local Error Resume Next
RaiseBar StatusBar
lblStatusText.Width = lblExtraCaption.Left - 8
IndentLabel lblDateTime, CInt(StatusBar.hWnd)
IndentLabel lblNumlock, CInt(StatusBar.hWnd)
IndentLabel lblCapsLock, CInt(StatusBar.hWnd)
IndentLabel lblExtraCaption, CInt(StatusBar.hWnd)
IndentLabel lblStatusText, CInt(StatusBar.hWnd)
End Sub
Sub ToolBar_Paint ()
RaiseBar ToolBar
End Sub
Sub ToolBar_Resize ()
ReDim Positions(13) As Integer
Positions(0) = True
Positions(1) = BUTTON_NEW
Positions(2) = BUTTON_OPEN
Positions(3) = True
Positions(4) = BUTTON_PRINT
Positions(5) = True
Positions(6) = BUTTON_FIND
Positions(7) = BUTTON_CUT
Positions(8) = BUTTON_COPY
Positions(9) = BUTTON_PASTE
Positions(10) = RIGHT_JUSTIFY_BUTTONS
Positions(11) = True
Positions(12) = BUTTON_HELP
Positions(13) = BUTTON_TOOLTIPS
Call PositionButtons(Positions(), ToolBar)
ToolBar.Height = ToolButton(0).Top * 2 * Screen.TwipsPerPixelY + (ToolButton(0).Height + 1) * Screen.TwipsPerPixelY
ToolBar.Cls
Call ToolBar_Paint
End Sub
Sub ToolButton_MouseDown (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
ToolButtonMouseDown Index, Button, Shift, X, Y
End Sub
Sub ToolButton_MouseMove (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Index = BaseButton(Index)
Call SetStatusText(GetMenuTag(Index))
Call ToolHelp(ToolButton(Index), X, Y)
End Sub
Sub ToolButton_MouseUp (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
ToolButtonMouseUp Index, Button, Shift, X, Y
End Sub